<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <h1>{{str}}</h1>
    <button @click="btn">逆转世界</button>
  </div>
  <script src="./js/vue-2.7.14.js"></script>
  <script>
    let app = new Vue({
      el: '#app',
      data: {
        str: 'Hello,World'
      },
      methods: {
        btn() {
          // 将字符串拆分成数组,再将数组倒转,然后进行拼接
          this.str = this.str.split('').reverse().join('')
        }
      }
    })
  </script>
</body>

</html>